/**
 * 按题意操作即可
 */
class Solution {

using llt = long long;
using vll = vector<llt>;
using vi = vector<int>;

public:
    int generateKey(int num1, int num2, int num3) {
        string a[3] = {to_string(num1), to_string(num2), to_string(num3)};
        for(auto & s : a){
            while(s.length() < 4){
                s.insert(s.begin(), '0');
            }
        }

        string ans;
        for(int i=0;i<4;++i){
            char ch = 127;
            for(const auto & s : a){
                ch = min(ch, s[i]);
            }
            ans.push_back(ch);
        }

        // reverse(ans.begin(), ans.end());
        int x = 0;
        for(auto c : ans) x = x * 10 + (c - '0');
        return x;
    }
};